package com.iven.xie.designpattern.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author xiezhendong
 * @date 2021/8/3
 */
public class ObjectStructure {
    private List<ComputerPart> list = new ArrayList<ComputerPart>();

    public void accept(ComputerPartVisitor visitor) {
        for (ComputerPart computerPart : list) {
            computerPart.accept(visitor);
        }
    }

    public void add(ComputerPart element) {
        list.add(element);
    }

    public void remove(ComputerPart element) {
        list.remove(element);
    }
}
